<?php
/**
 * This file is form http://findcat.cn
 *
 * @link     https://findcat.cn
 * @email    1476982312@qq.com
 */
namespace Blog\Seeder\Admin\Test;

use Carbon\Carbon;
use App\Models\Article;
use Illuminate\Database\Seeder;

class ArticleTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run()
    {
        $data = [
            [
                'categories_id' => '1',
                'title'         => '测试文章',
                'admin_user_id' => '2',
                'content'       => '<p>[TOC]</p><h4>前言：此处使用easy-admin项目的easy-mall进行举例，其他项目同理</h4><h4>一、将easy-mall扩展包拉取到本地</h4><h5>1、创建本地包存放路径</h5><p>在项目根目录下创建 <code>packages</code> 文件夹，用来存放我们的composer 扩展包</p><h5>2、拉取composer扩展包</h5><p>在 <code>packages</code> 文件夹下新建 <code>mallto</code> 文件夹用来存放公司内部开发的扩展包，然后进入到 <code>mallto</code> 文件夹，使用 <code>git</code> 拉取代码仓库中的 easy-mall 扩展包。步骤如下：</p><pre><code class="language-git">//拉取easy-mall扩展包
git clone git@code.aliyun.com:mall-to/easy-mall.git

//进入扩展包的目录内
cd easy-mall

//切换分支到develop开发分支上
git checkout -b develop  origin/develop</code></pre><h4>二、修改composer.json文件</h4><h5>1、示例代码</h5><p><strong>注意：此处需要修改示例代码中的第17行："mallto/easy-mall": "@dev"，还有第82行："type": "path" 和第83行 "url": "packages/mallto/easy-mall"，让其关联到我们刚刚拉取的扩展包</strong></p><pre><code class="language-json">{
    &quot;name&quot;: &quot;laravel/laravel&quot;,
    &quot;description&quot;: &quot;The Laravel Framework.&quot;,
    &quot;keywords&quot;: [
        &quot;framework&quot;,
        &quot;laravel&quot;
    ],
    &quot;license&quot;: &quot;MIT&quot;,
    &quot;type&quot;: &quot;project&quot;,
    &quot;require&quot;: {
        &quot;php&quot;: &quot;&gt;=7.1.3&quot;,
        &quot;aliyun/aliyun-tablestore-sdk-php&quot;: &quot;^4.1&quot;,
        &quot;codingyu/ueditor&quot;: &quot;dev-master&quot;,
        &quot;encore/laravel-admin&quot;: &quot;dev-1.5_develop&quot;,
        &quot;mallto/easy-gateway-location&quot;: &quot;dev-develop&quot;,
        &quot;mallto/easy-location&quot;: &quot;dev-develop&quot;,
        &quot;mallto/easy-mall&quot;: &quot;@dev&quot;,
        &quot;mallto/easy-scenic&quot;: &quot;dev-develop&quot;,
        &quot;mallto/easy-tool&quot;: &quot;dev-develop&quot;,
        &quot;mallto/easy-user&quot;: &quot;dev-develop&quot;,
        &quot;mallto/laravel-admin-enhance&quot;: &quot;dev-develop&quot;,
        &quot;moolex/aliyun-sls-sdk-php&quot;: &quot;dev-master&quot;
    },
    &quot;require-dev&quot;: {
        &quot;filp/whoops&quot;: &quot;~2.0&quot;,
        &quot;fzaninotto/faker&quot;: &quot;~1.4&quot;,
        &quot;mockery/mockery&quot;: &quot;~1.0&quot;,
        &quot;nunomaduro/collision&quot;: &quot;~3.0&quot;,
        &quot;phpunit/phpunit&quot;: &quot;~7.5&quot;
    },
    &quot;autoload&quot;: {
        &quot;classmap&quot;: [
            &quot;database/seeds&quot;,
            &quot;database/factories&quot;
        ],
        &quot;psr-4&quot;: {
            &quot;App\&quot;: &quot;app/&quot;
        }
    },
    &quot;autoload-dev&quot;: {
        &quot;psr-4&quot;: {
            &quot;Tests\&quot;: &quot;tests/&quot;
        }
    },
    &quot;extra&quot;: {
        &quot;laravel&quot;: {
            &quot;dont-discover&quot;: [
            ]
        }
    },
    &quot;scripts&quot;: {
        &quot;post-root-package-install&quot;: [
            &quot;php -r \&quot;file_exists(\'.env\') || copy(\'.env.example\', \'.env\');\&quot;&quot;
        ],
        &quot;post-create-project-cmd&quot;: [
            &quot;php artisan key:generate&quot;
        ],
        &quot;post-autoload-dump&quot;: [
            &quot;Illuminate\Foundation\ComposerScripts::postAutoloadDump&quot;,
            &quot;php artisan package:discover&quot;
        ]
    },
    &quot;config&quot;: {
        &quot;optimize-autoloader&quot;: true,
        &quot;preferred-install&quot;: &quot;dist&quot;,
        &quot;sort-packages&quot;: true,
        &quot;http-basic&quot;: {
            &quot;code.aliyun.com&quot;: {
                &quot;username&quot;: &quot;1476982312@qq.com&quot;,
                &quot;password&quot;: &quot;liang1395..&quot;
            }
        }
    },
    &quot;minimum-stability&quot;: &quot;dev&quot;,
    &quot;prefer-stable&quot;: true,
    &quot;repositories&quot;: [
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/laravel-admin.git&quot;
        },
        {
            &quot;type&quot;: &quot;path&quot;,
            &quot;url&quot;: &quot;packages/mallto/easy-mall&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/easy-user.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/easy-tool.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/aliyun-sls-sdk-php.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/easy-location.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/laravel-admin-enhance.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/easy-scenic.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@github.com:never615/UEditor.git&quot;
        },
        {
            &quot;type&quot;: &quot;vcs&quot;,
            &quot;url&quot;: &quot;git@code.aliyun.com:mall-to/easy-gateway-location.git&quot;
        }
    ]
}
</code></pre><h4>三、删除composer.lock文件</h4><p><strong>注意：很多人修改了composer.json文件，然后高高兴兴去composer install了，发现项目并没有依赖到本地的扩展包，就是因为没有删除composer.lock文件，至于这个composer.lock文件有什么用，请去仔细阅读官方文档。</strong></p><h4>四、安装依赖，让其生成新的composer.lock文件</h4><pre><code class="language-git">//安装依赖
composer install</code></pre><p><strong>安装完毕后，就可以去使用本地的扩展包了</strong></p>',
                'markdown'      => '[TOC]

#### 前言：此处使用easy-admin项目的easy-mall进行举例，其他项目同理

#### 一、将easy-mall扩展包拉取到本地
##### 1、创建本地包存放路径
在项目根目录下创建 `packages` 文件夹，用来存放我们的composer 扩展包

##### 2、拉取composer扩展包
在 `packages` 文件夹下新建 `mallto` 文件夹用来存放公司内部开发的扩展包，然后进入到 `mallto` 文件夹，使用 `git` 拉取代码仓库中的 easy-mall 扩展包。步骤如下：
```git
//拉取easy-mall扩展包
git clone git@code.aliyun.com:mall-to/easy-mall.git

//进入扩展包的目录内
cd easy-mall

//切换分支到develop开发分支上
git checkout -b develop  origin/develop
```
#### 二、修改composer.json文件
##### 1、示例代码
**注意：此处需要修改示例代码中的第17行："mallto/easy-mall": "@dev"，还有第82行："type": "path" 和第83行 "url": "packages/mallto/easy-mall"，让其关联到我们刚刚拉取的扩展包**
```json
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.1.3",
        "aliyun/aliyun-tablestore-sdk-php": "^4.1",
        "codingyu/ueditor": "dev-master",
        "encore/laravel-admin": "dev-1.5_develop",
        "mallto/easy-gateway-location": "dev-develop",
        "mallto/easy-location": "dev-develop",
        "mallto/easy-mall": "@dev",
        "mallto/easy-scenic": "dev-develop",
        "mallto/easy-tool": "dev-develop",
        "mallto/easy-user": "dev-develop",
        "mallto/laravel-admin-enhance": "dev-develop",
        "moolex/aliyun-sls-sdk-php": "dev-master"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "nunomaduro/collision": "~3.0",
        "phpunit/phpunit": "~7.5"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists(\'.env\') || copy(\'.env.example\', \'.env\');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "php artisan package:discover"
        ]
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "http-basic": {
            "code.aliyun.com": {
                "username": "1476982312@qq.com",
                "password": "liang1395.."
            }
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/laravel-admin.git"
        },
        {
            "type": "path",
            "url": "packages/mallto/easy-mall"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/easy-user.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/easy-tool.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/aliyun-sls-sdk-php.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/easy-location.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/laravel-admin-enhance.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/easy-scenic.git"
        },
        {
            "type": "vcs",
            "url": "git@github.com:never615/UEditor.git"
        },
        {
            "type": "vcs",
            "url": "git@code.aliyun.com:mall-to/easy-gateway-location.git"
        }
    ]
}

```

#### 三、删除composer.lock文件
**注意：很多人修改了composer.json文件，然后高高兴兴去composer install了，发现项目并没有依赖到本地的扩展包，就是因为没有删除composer.lock文件，至于这个composer.lock文件有什么用，请去仔细阅读官方文档。**

#### 四、安装依赖，让其生成新的composer.lock文件
```git
//安装依赖
composer install
```
**安装完毕后，就可以去使用本地的扩展包了**',
                'description'   => '前言：在日常开发中，我们可能会写出一些bug，但是项目已经上线了，我们无法第一时间得到客户的反馈，这时候邮件报错系统就派上用场了，我们都知道laravel的异常处理都需要通过Handler.php文件来处理，那么就从此处开始入手',
                'keywords'      => '邮件系统，laravel',
                'cover'         => 'images/06e2cb053e48ef81711b763eaf090884.png',
                'is_top'        => 1,
                'status'        => 1,
                'click'         => 223,
                'created_at'    => Carbon::now(),
                'updated_at'    => Carbon::now(),
            ],
        ];

        for ($i = 0; $i < 30; $i++) {
            Article::query()->insert($data);
        }
    }
}
